package org.vectrics.common.util;


import java.io.FileWriter;


public class FileLogger {
    static FileWriter fileWriter = null;
    static String fileName = "vectrics.err";
    public static boolean UseSystemOut = false;

    static public void setFileName(String iFileName)
    {
        fileName = iFileName;
        fileWriter = null;
    };

    static private FileWriter file() throws java.io.IOException {
        if (fileWriter == null)
            fileWriter = new FileWriter(fileName);
        return(fileWriter);
    }

    
    static public void log(String iStr)
    {
        try {
            if (UseSystemOut)
                System.out.println(iStr);
            else {
                
                file().write(iStr + "\r\n");
                file().flush();
            }
        }
        catch (Exception e) {

        };
    };

}